package com.my.fp.basic;

import com.my.bean.User;

/**
 * @author: marshal
 * @date: 2021-12-21 1:59 PM
 */
public class SwitchPM {
    public static void main(String[] args) {
        System.out.println(test(10));
        System.out.println(test(1.0f));
        System.out.println(test(new User()));
    }

    public static String test(Object obj) {
        return switch (obj) {
            case Integer i -> "This is Integer.";
            case String s -> "This is String.";
            case Float f -> "This is Float.";
            case Double d -> "This is Double.";
            default -> "This is an object";
        };
    }
}
